<?php
/**
 * Magento Enterprise Edition
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Magento Enterprise Edition End User License Agreement
 * that is bundled with this package in the file LICENSE_EE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.magento.com/license/enterprise-edition
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    Mage
 * @package     Mage_Customer
 * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
 * @license http://www.magento.com/license/enterprise-edition
 */

/**
 * API2 class for customer (admin)
 *
 * @category   Mage
 * @package    Mage_Customer
 * @author     Magento Core Team <core@magentocommerce.com>
 */
class ApiCenter_VendorsApi_Model_Api2_Account_Password_Rest_Admin_V1 extends ApiCenter_VendorsApi_Model_Api2_Account_Password_Rest{
   
   
    protected  function _update($filteredData){
        $vendorId = $this->getRequest()->getParam("vendorid");
        try{
            $vendor = Mage::getModel("vendors/vendor")->load($vendorId);
            
            if(!$vendor->getId()||empty($filteredData)){
                $this->_critical("用户信息错误",400);
            }
            try{
                $this->_authenticate($vendor, $filteredData['oldpwd']);
            } catch (Exception $e) {
                $this->_critical("原密码错误",400);
            }
            $vendor->setPassword($filteredData['newpwd']);
            $vendor->setConfirmation($filteredData['newpwd']);
            $vendor->setNewPassword($filteredData['newpwd']);
     
            $vendor->save();
      
            $res['status']=1;
            $res['info']="保存成功";     
        } catch (Exception $e) {
            $res['status']=0;
            $res['info']=$e->getMessage();
        }
        $this->_render($res);
}
    
    
    
    

}
